#ifndef CRC8_H__
#define CRC8_H__

typedef struct Struct_CRC8_16 {
    char crcName[16];
    unsigned char crcPoly;
    unsigned char crcInit;
    unsigned char crcXor;
    unsigned char crcTable[16];
    unsigned char crcRefIn;
    unsigned char crcRefOut;
} CRC8_16;

typedef struct Struct_CRC8_256 {
    char crcName[16];
    unsigned char crcPoly;
    unsigned char crcInit;
    unsigned char crcXor;
    unsigned char crcTable[256];
    unsigned char crcRefIn;
    unsigned char crcRefOut;
} CRC8_256;

void create_crc8_table16(CRC8_16 * p_crc8_16);
void create_crc8_table256(CRC8_256 * p_crc8_256);
void prepare_crc8_with_table16(CRC8_16 * p_crc, unsigned char * crc8);
void process_crc8_with_table16(CRC8_16 * p_crc, const unsigned char * character, unsigned char * crc8);
void complete_crc8_with_table16(CRC8_16 * p_crc, unsigned char * crc8);
void prepare_crc8_with_table256(CRC8_256 * p_crc, unsigned char * crc8);
void process_crc8_with_table256(CRC8_256 * p_crc, const unsigned char * character, unsigned char * crc8);
void complete_crc8_with_table256(CRC8_256 * p_crc, unsigned char * crc8);
unsigned char generate_crc8(void *p_crc, unsigned int crc_table_size, const unsigned char * data, unsigned int length);

#endif //CRC8_H__
